package source.realRobot;

import source.Enums.Direction;
import source.calcCmd.RealLifeProperties;
import source.calcCmd.RobotCommand;

public class Wheel {

	private double v;
	private double direction;
	
	public Wheel(){
		v = 0;
		direction = 1;
	}
	
	public void setNewVelocity(long timeElapsed){
		double timeInSec = timeElapsed * (1/(double)RealLifeProperties.s2ns);
		double distInMet = RealLifeProperties.StepDistanceMM * (1 / (double)RealLifeProperties.m2mm);
		v = distInMet / timeInSec;
	}
	
	public double getV(){
		return v*direction;
	}
	
	public void setV(double v){
		this.v = v;
	}
	
	public void setDir(Direction dir){
		switch (dir){
		case FORWARD:
			direction = 1;
			break;
		case BACKWARD:
			direction = -1;
			break;
		}
	}

	public void reset() {
		v = 0;		
		direction = 1;
	}

	public double getDir() {
		// TODO Auto-generated method stub
		return direction;
	}
}
